<script setup lang='ts'>
import { PropertyCompCallbackFuncParamsType } from "./base";

type FunctionValue = string | number | boolean | string[] | number[] | boolean[]

const props = withDefaults(defineProps<{
    property: any
}>(), {
});
const emits = defineEmits<{
    (e: 'callback', params: PropertyCompCallbackFuncParamsType): void;
}>();

const { property } = props
const { paramsProperty } = property;
const readonly = paramsProperty.readonly
const func = () => property.exec();
</script>

<template>
    <div class="readonly_flag" :class="readonly ? 'readonly_none' : ''">
        <button @click="func">{{ property.name }}</button>
    </div>
</template>

<style scoped>
button {
    width: auto;
    height: 32px;
    line-height: 12px;
    background: rgba(28, 28, 29, 0.6);
    border-radius: 4px;
    border: 1px solid #3b3c40;
    cursor: pointer;
    color: rgba(230, 230, 230, 1);
    padding: 10px;
    margin-right: 10px;
}

button:hover {
   border: 1px solid rgba(44, 104, 247, 1);
}

.readonly_flag {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
}


.readonly_none {
    pointer-events: none;
}
</style>
